package com.hong.qrpc.constant;

/**
 * @Author HQT
 * @Date 2022/8/9 20:39
 */
public abstract class ProtoTypeConst {
    public static final int HTTP = 1;
    public static final int QRPC = 2;

    public static boolean isSupport(String protoType) {
        if ("http".equalsIgnoreCase(protoType)) {
            return true;
        } else if ("qrpc".equalsIgnoreCase(protoType)) {
            return true;
        } else {
            return false;
        }
    }

    public static int getProtoTypeNum(String protocol) {
        if ("http".equalsIgnoreCase(protocol)) {
            return HTTP;
        } else if ("qrpc".equalsIgnoreCase(protocol)) {
            return QRPC;
        } else {
            throw new IllegalArgumentException("unsupported protocol");
        }
    }
}
